#!/bin/sh

set -e
SRC='aspose-words-22.12-jdk17.jar'
DST='aspose-words-22.12-jdk17-cracked.jar'
echo '==> 官网下载（新下载的此破解已失效，请直接下载破解版）'
stat aspose-words-22.12-jdk17.jar || wget https://releases.aspose.com/java/repo/com/aspose/aspose-words/22.12/aspose-words-22.12-jdk17.jar
echo '==> 重命名'
rm -f $DST
cp $SRC $DST

echo '==> 执行破解,生成类'
javac -classpath .:javassist-3.29.2-GA.jar AsposeWords_22_12.java
java  -classpath .:javassist-3.29.2-GA.jar AsposeWords_22_12

echo '==> 用jar命令更新jar内的类'
echo '替换前'
jar -uvf0 $DST com/aspose/words/*.class
jar -uvf0 aspose-words-22.12-jdk17.jar com/aspose/words/*.class

echo '==> 替换UCCESS。'
echo '==> 用压缩工具打开，并删除 /MANIFEST.MF 目录下的*.SF,*.RSA文件，以及删除 versions 目录。'
echo '==> DONE.'